<?php
namespace app\validate;

use app\base\BaseValidate;

/**
 * 验证器-GoodsValidate
 * Class GoodsValidate
 * @package app\validate
 */
class GoodsValidate extends BaseValidate
{
    protected $rule = [
        'id' => 'require|number',
        'goods_type_id|商品分类' => 'require|number|notIn:0',
        'goods_title|商品名称' => 'require',
        'goods_img|商品封面' => 'require',
        'goods_photo|商品相册' => 'require',
        'goods_detail|商品详情' => 'require',
        'goods_return_agency_money|代理商佣金' => 'require|float',
        'goods_return_money|用户购买返现' => 'require|float',
        'goods_top_money|推荐人购买返回佣金' => 'require|float',
        'goods_status|上线' => 'require|in:1,2,3,4',
        'goods_hot_status|热门' => 'require|in:1,2',
        'goods_recommend|推荐' => 'require|in:1,2',
        'freight_id|运费模板' => 'require|number|notIn:0',
        'sort|排序' => 'require'
    ];

    //验证场景-上线状态
    public function sceneUpStatus()
    {
        return $this->only(['id','goods_status']);
    }


    //验证场景-热门状态
    public function sceneUpHotStatus()
    {
        return $this->only(['id','goods_hot_status']);
    }

}
